package project.menu.ordermenu.listmadingorders;

import java.util.ArrayList;

import project.controllers.Messager;
import project.controllers.Printer;
import project.menu.IMenu;
import project.menu.IMenuItem;
import project.work.Navigator;
import controllers.IAutoservice;
import entities.IOrder;

public class MadingOrdersByFillingDate implements IMenuItem {

	private String name = "Sort by fillingDate";
	private final Integer id = 1;
	private static IMenu submenu;	
	private Navigator navigator;
	
	public MadingOrdersByFillingDate(){
		navigator=Navigator.getInstance();
	}
	
	public Integer getId() {
		return id;
	}

	
	public String getNameItem() {
		return name;
	}

	public static void setMenu(IMenu menu) {
		submenu = menu;
	}
	
	public void action(IAutoservice autoservice) {
		ArrayList<IOrder> temp=autoservice.SortMadingOrderByFillinggDate();
		for (IOrder order :temp ) {		
			Printer.printMessage(Messager.ORDER_NUMBER+ order.getNumberOrder());
		}
		
		navigator.drawMenu(submenu);
	}

	
}
